<template>
  <div>
    <el-form ref="formRef" :model="formData" :rules="formRule" label-width="200px" >
      <el-form-item label="免物流" prop="is_need" required>
        <el-radio-group v-model="formData.is_need">
          <el-radio :value="1">是</el-radio>
          <el-radio :value="2">否</el-radio>
        </el-radio-group>
        <el-text type="info" style="margin-left:30px">会员购买免物流商品时，不需要填写收货地址。</el-text>
      </el-form-item>
      <el-form-item label="是否为虚拟产品" prop="is_xuni" required>
        <el-radio-group v-model="formData.is_need">
          <el-radio :value="1">是</el-radio>
          <el-radio :value="2">否</el-radio>
        </el-radio-group>
        <el-text type="info" style="margin-left:30px">若为虚拟产品，首次添加库存默认为0。可在商品列表“操作”下的“虚拟商品库”中添加商品，库存根据添加的产品自动更新。
        </el-text>
      </el-form-item>
      <el-form-item label="会员手机号姓名是否必须" prop="is_name" required>
        <el-radio-group v-model="formData.is_name">
          <el-radio :value="1">是</el-radio>
          <el-radio :value="2">否</el-radio>
        </el-radio-group>
      </el-form-item>

      <el-form-item label="运费设置" prop="set">
        <el-radio-group v-model="formData.set">
          <el-radio :value="1">包邮</el-radio>
          <el-radio :value="2">否</el-radio>
          <el-radio :value="3">统一运费</el-radio>
          <div style="margin-left: -20px;margin-right: 30px" v-if="formData.set === 3">
            <el-input v-model.trim="formData.fee" clearable placeholder="" style="width: 150px">
              <template #append>元</template>
            </el-input>
          </div>
          <el-radio :value="4">运费模板</el-radio>
          <div style="margin-left: -20px;margin-right: 30px" v-if="formData.set === 4">
            <el-select v-model="formData.feeId" placeholder="请选择" style="width: 240px">
<!--              <el-option-->
<!--                  v-for="item in options"-->
<!--                  :key="item.value"-->
<!--                  :label="item.label"-->
<!--                  :value="item.value"-->
<!--              />-->
            </el-select>
          </div>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="满件包邮" prop="title">
        <el-input v-model.trim="formData.title" clearable placeholder="" style="width: 150px">
          <template #append>件</template>
        </el-input>
      </el-form-item>
    </el-form>
    </div>
</template>

<script setup>
import { getCurrentInstance, ref, onMounted, shallowRef, reactive, onBeforeUnmount } from "vue"
import { useRouter } from "vue-router"
import { UploadFilled, CloseBold } from "@element-plus/icons-vue"
import GoBack from "@components/GoBack.vue"
import "@wangeditor/editor/dist/css/style.css"
import { Editor, Toolbar } from "@wangeditor/editor-for-vue"
import PictureLibrary from "@components/PictureLibrary.vue"
import BaseSteps from "@components/BaseSteps.vue";

const router = useRouter()
const { proxy } = getCurrentInstance()

onMounted(() => {
  // getClass()
})
// 组件销毁时，也及时销毁编辑器
onBeforeUnmount(() => {

})

/**
 * 添加
 * @property {Boolean} form_loading 提交按钮状态
 * @property {Number} classType 弹窗类型，1是添加，2是编辑
 * @property {Array} formRef 表单规则
 * @property {Object} formData  表单字段
 * @property {Object} formRule  表单提示
 * @property {Function} submitNewsForm 提交表单
 */
const form_loading = ref(false)
const formRef = ref(null)
const formData = reactive({
  sub_cate_id: null,
  cate_id: "",
  title: "",
  dates: "",
  sort: "100",
  news_status: 0, // [0:显示,1:隐藏]
  audit: 1, // 0:待审核,1:已通过
  img_paths: "",
})
const formRule = reactive({
  cate_id: [{ required: true, message: "请选择文章分类", trigger: "change" }],
  title: [{ required: true, message: "请输入文章标题", trigger: "blur" }],
  img_paths: [{ required: true, message: "请选择封面图片", trigger: "blur" }],
  dates: [{ required: true, message: "请选择发布时间", trigger: "change" }],
  sort: [{ required: true, message: "请输入排序数字", trigger: "blur" }],
})
const submitNewsForm = (formEl) => {
  if (!formEl) return
  formEl.validate((valid, fields) => {
    if (valid) {

    }
  })
}
</script>
<script>
export default {
  name: "logistics",
}
</script>

<style lang="less" scoped>

</style>
